#ifndef __iGraphicsSubsystem__
#define __iGraphicsSubsystem__

#include "neiderra/core/Core.h"
#include "neiderra/core/iSubsystem.h"

namespace neiderra
{
	using core::Core;
	using core::iSubsystem;

	namespace rendering
	{
		class iRenderer;
	}
	using rendering::iRenderer;

	namespace gui
	{
		class EventManager;
		class EventDispatcher;
		class EventListener;
		class GUIWindow;

		class iGraphicsSubsystem: public iSubsystem
		{
		public:
			iGraphicsSubsystem(Core* core): 
			  iSubsystem(core) 
			{
				_eventManager = 0;
				_eventDispatcher = 0;
				_eventListener = 0;
				_renderer = 0;
			}
			virtual ~iGraphicsSubsystem() {}

			virtual void update(double dT){};
			
			virtual void setEventManager(EventManager* manager) { _eventManager = manager; }
			virtual void setEventDispatcher(EventDispatcher* dispatcher) { _eventDispatcher = dispatcher; }
			virtual void setRenderer(iRenderer* renderer);
			virtual void setEventListener(EventListener* listener) { _eventListener = listener; }

			virtual EventManager* getEventManager() { return _eventManager; }
			virtual iRenderer* getRenderer() { return _renderer; }
			virtual EventDispatcher* getEventDispatcher() { return _eventDispatcher; }
			virtual EventListener* getEventListener() { return _eventListener; }

			virtual GUIWindow* createSystemWindow(const std::string& title){ return 0; };
			//virtual GUIWindow* createSystemWindow(const std::string& title, int x, int y, int width, int height, GUIWindow* parent){ return 0; };
			// fixme: deprecated, use iRenderTarget->makeCurrent()
			//virtual void makeCurrentWindow(GUIWindow*){};
			
		protected:
			EventManager* _eventManager;
			EventDispatcher* _eventDispatcher;
			iRenderer* _renderer;
			EventListener* _eventListener;
		};
	}
}

#endif

